package com.school.sys.module.dao;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.school.sys.module.entity.Module;
import com.school.util.BaseDAO;
import com.school.util.Parameter;

@Repository
public class ModuleDAO extends BaseDAO<Module>{
	
	@SuppressWarnings("unchecked")
	public List<Module> getModuleAll(Parameter p){
		List<Module> list = null;
		String jpql = "select m from Module m";
		Query query = getEm().createQuery(jpql);
		query.setFirstResult((p.getPage()-1)*p.getPagesize());
		query.setMaxResults(p.getPagesize());
		list = query.getResultList();
		return list;
	}
}
